﻿using ProtoBuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZyGames.Framework.Common;
using ZyGames.Framework.Model;

namespace ZyGames.DZPocker.Model
{
	/// <summary>
	/// 每一桌牌的每一局(手)
	/// </summary>
	[Serializable, ProtoContract]
	[EntityTable(CacheType.Dictionary, DbConfig.Data)]
	public class UserAndTable : BaseEntity
	{
		public UserAndTable()
			: base(false)
		{
		}
		public UserAndTable(int id, int userId, int tableId, int profit, bool isMaster, string nickName, string headIcon = "")
			: this()
		{
			ID = id;
			UserID = userId;
			TableID = tableId;
			Profit = profit;
			IsMaster = isMaster;
			NickName = nickName;
			HeadIcon = headIcon;
		}
		
		/// <summary>
		/// ID
		/// </summary>        
		[ProtoMember(1)]
		[EntityField(true)]
		public int ID { get; set; }

		/// <summary>
		/// 玩家ID
		/// </summary>        
		[ProtoMember(2)]
		[EntityField]
		public int UserID { get; set; }

		/// <summary>
		/// 桌子ID
		/// </summary>        
		[ProtoMember(3)]
		[EntityField]
		public int TableID { get; set; }

		/// <summary>
		/// 盈亏(玩家在这个桌子的盈亏)
		/// </summary>        
		[ProtoMember(4)]
		[EntityField]
		public int Profit{ get; set; }

		/// <summary>
		/// 是否是房主
		/// </summary>
		[ProtoMember(5)]
		[EntityField]
		public bool IsMaster { get; set; }

		[ProtoMember(6)]
		[EntityField]
		public string NickName { get; set; }

		[ProtoMember(7)]
		[EntityField]
		public string HeadIcon { get; set; }

		[ProtoMember(8)]
		[EntityField]
		public bool IsInsurancer { get; set; }

		protected override int GetIdentityId()
		{
			return ID;
		}
	}
}
